//
//  LBRequestEncryption.m
//  LBNetworking
//
//  Created by WuShiHai on 19/5/30.
//  Copyright (c) 2019 Lebbay. All rights reserved.
//

#import "LBRequestEncryption.h"
#import <CommonCrypto/CommonHMAC.h>

@implementation LBRequestEncryption

//加密
+ (NSString *)encrypt:(NSString *)_data{
    NSString *loc_str=@"";
    loc_str=[NSString stringWithFormat:@"%@%@sjdo12379341jik890879&*#@$^&*Q*&",loc_str,_data];
    return [self encryptMD5String:loc_str];
}
//md5加密
+ (NSString*)encryptMD5String:(NSString*)string{
    const char *cStr = [string UTF8String];
    unsigned char result[32];
    CC_MD5( cStr, (int)strlen(cStr),result );
    NSMutableString *hash =[NSMutableString string];
    for (int i = 0; i < 16; i++)
        [hash appendFormat:@"%02X", result[i]];
    
    //return hash;
    return [hash uppercaseString];//此方法输出的是大写，若想要以小写的方式输出，则只需要将最后一行代码改为return [hash lowercaseString];
    //return [hash lowercaseString];
}


@end
